package com.study.leetcode;

public class Solution_283 {
    public void moveZeroes(int[] nums) {
        int length = nums.length;
        int cur = 0;
        //不是0的前移
        for (int i = 0; i < length; i++) {
            if (nums[i] != 0) {
                nums[cur++] = nums[i];
            }
        }
        //剩下的就是0
        for (int i = cur - 1; i < length; i++) {
            nums[i] = 0;
        }
    }
}
